package com.ruoyi.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.BasisProcessDataMapper;
import com.ruoyi.service.IBasisProcessDataService;

/**
 * 过程数据管理Service业务层处理
 * 
 * @author wangzebing
 * @date 2025-03-28
 */
@Service
public class BasisProcessDataServiceImpl implements IBasisProcessDataService 
{
    @Autowired
    private BasisProcessDataMapper basisProcessDataMapper;

    /**
     * 查询过程数据管理
     * 
     * @param id 过程数据管理主键
     * @return 过程数据管理
     */
    @Override
    public BasisProcessData selectBasisProcessDataById(Long id)
    {
        return basisProcessDataMapper.selectBasisProcessDataById(id);
    }

    /**
     * 查询过程数据管理列表
     * 
     * @param basisProcessData 过程数据管理
     * @return 过程数据管理
     */
    @Override
    public List<BasisProcessData> selectBasisProcessDataList(BasisProcessData basisProcessData)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisProcessData.setUserId(user.getUserId());
        return basisProcessDataMapper.selectBasisProcessDataList(basisProcessData);
    }

    /**
     * 新增过程数据管理
     * 
     * @param basisProcessData 过程数据管理
     * @return 结果
     */
    @Override
    public int insertBasisProcessData(BasisProcessData basisProcessData)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisProcessData.setUserId(user.getUserId());
        basisProcessData.setCreateTime(new Date());
        return basisProcessDataMapper.insertBasisProcessData(basisProcessData);
    }

    /**
     * 修改过程数据管理
     * 
     * @param basisProcessData 过程数据管理
     * @return 结果
     */
    @Override
    public int updateBasisProcessData(BasisProcessData basisProcessData)
    {
        return basisProcessDataMapper.updateBasisProcessData(basisProcessData);
    }

    /**
     * 批量删除过程数据管理
     * 
     * @param ids 需要删除的过程数据管理主键
     * @return 结果
     */
    @Override
    public int deleteBasisProcessDataByIds(Long[] ids)
    {
        return basisProcessDataMapper.deleteBasisProcessDataByIds(ids);
    }

    /**
     * 删除过程数据管理信息
     * 
     * @param id 过程数据管理主键
     * @return 结果
     */
    @Override
    public int deleteBasisProcessDataById(Long id)
    {
        return basisProcessDataMapper.deleteBasisProcessDataById(id);
    }

    @Override
    public List<BaseBehaviormanagementLog> getCommandList(BasisProcessDataBo basisProcessData) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisProcessData.setUserId(user.getUserId());
        return basisProcessDataMapper.selectBaseBehaviorLog(basisProcessData);
    }

    @Override
    public List<FileEntityPo> getAcceptEffectList(BasisProcessDataBo basisProcessData, List<Integer> userIdList) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisProcessData.setUserId(user.getUserId());
        return basisProcessDataMapper.selectFiles(basisProcessData, userIdList);
    }

    @Override
    public List<BaseSignalanalysisInfo> getSimulationEventList(BasisProcessDataBo basisProcessData, List<Integer> userIdList) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisProcessData.setUserId(user.getUserId());
        return basisProcessDataMapper.selectSignalanalysisList(basisProcessData, userIdList);
    }

    @Override
    public List<Integer> getUserList() {
        return basisProcessDataMapper.selectUserIdList();
    }
}
